import request from '@/utils/request'

// 查询订单列表
export function listOrder(query) {
  return request({
    url: '/order/order/list',
    method: 'get',
    params: query
  })
}

// 查询订单详细
export function getOrder(id) {
  return request({
    url: '/order/order/' + id,
    method: 'get'
  })
}
// 查询订单详细
export function getOrderDetail(id) {
  return request({
    url: '/order/order/detail/' + id,
    method: 'get'
  })
}

// 新增订单
export function addOrder(data) {
  return request({
    url: '/order/order',
    method: 'post',
    data: data
  })
}

// 修改订单
export function updateOrder(data) {
  return request({
    url: '/order/order',
    method: 'put',
    data: data
  })
}

// 删除订单
export function delOrder(id) {
  return request({
    url: '/order/order/' + id,
    method: 'delete'
  })
}

// 导出订单
export function exportOrder(query) {
  return request({
    url: '/order/order/export',
    method: 'get',
    params: query
  })
}

// 取消订单
export function cancelOrder(id) {
  return request({
    url: '/order/order/cancel/'+id,
    method: 'post'
  })
}

// 订单退款
export function refundOrder(id) {
  return request({
    url: '/order/refund/create/'+id,
    method: 'post'
  })
}


// 受理订单
export function mjslOrder(id) {
  return request({
    url: '/order/order/mjsl/'+id,
    method: 'post'
  })
}

// 完结订单
export function mjwjOrder(data) {
  return request({
    url: '/order/order/mjwj',
    method: 'post',
    data: data
  })
}

// 指派代驾司机
export function zpDriver(data) {
  return request({
    url: '/order/order/zpDriver/'+data.orderId+'/'+data.driverId,
    method: 'post'
  })
}

// 订单取还车地址信息
export function getOrderAddr(orderId) {
  return request({
    url: '/order/addr/orderId/'+orderId,
    method: 'get'
  })
}
